import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'controllers/count_controller.dart';


class ObxPage extends StatelessWidget {
  final GetXCountController _countController = Get.put(GetXCountController());
  final RxString _message = ''.obs;

  ObxPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Obx(() => Text('响应式数据${_message.value}'))),
      body: Center(
        child: Column(children: [Obx(() => Text('count: ${_countController.counter.value}'))]),
      ),
      floatingActionButton: FloatingActionButton(
        child: const Icon(Icons.add),
        onPressed: () {
          _countController.inc();
          _message.value='点击了${_countController.counter.value}次';
        },
      ),
    );
  }
}
